{% extends "common.html" %}
{% block css %}
<link href="/static/css/reset_menu.css" rel="stylesheet" type="text/css">
<link href="/static/css/style-static.css" rel="stylesheet" type="text/css">
<link href="/static/css/bootstrap.css" rel="stylesheet" type="text/css">
<script src="/static/js/artTemplate.js"></script>
 <script type="text/javascript" charset="utf-8" src="/static/js/ueditor.config.js"></script>
 <script type="text/javascript" charset="utf-8" src="/static/js/ueditor.all.min.js"> </script>
{% load i18n %}
<style type="text/css">
  .blue{
    background:#31d2e7;
    color: white;
  }
  .laydate_box, .laydate_box * {
        box-sizing:content-box;
    }
</style>
<script src="/static/js/laydate.js"></script>

{% endblock %}
{% block content %}

<!--------内容-------------->
<div class="edititem">
 {% include "companySide.html" %}
  <div class="enterprise">
    <form method="post" action="{% url "basic" %}" id="pickupForm">
     <!-- <h1>基本信息</h1> -->
    <h2><span></span>{% trans "basic" %}{% trans "information" %}</h2>
     <div class="form-horizontal text-left">
      <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "corp name" %}({% trans "abbreviation" %}):</label>
        <div class="col-sm-3">
          <input type="text" class="form-control" name="name" value="{{name}}" placeholder="奇創互動">
        </div>
   
        

      </div>

      <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "corp name" %}({% trans "fullName" %}):</label>
        <div class="col-sm-6 ">
          <input type="text" class="form-control" name="fullName" value="{{fullName}}" placeholder="北京奇創互動科技株式会社">
        </div>
        
      </div>

      <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "recommend" %}:</label>
        <div class="col-sm-6">
         <input type="text" class="form-control"  id="appName" name="recommend" value="{{recommend}}" >
       </div>
     </div>

     <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "url" %}:</label>
        <div class="col-sm-4">
    <input type="text" class="form-control" id="appName" name="url" value="{{url}}" >
       </div>
     </div>


     <div class="form-group">
      <label  class="col-sm-3 control-label">{% trans "introduce" %}:</label>
      <div class="col-sm-8">
      
        <script type="text/plain" id="jpDesc" style="width:600px;height:500px;">
       {{jpDesc|safe}}
    </script>
     </div>
   </div>


   <div class="form-group">
    <label  class="col-sm-3 control-label">{% trans "location" %}:</label>
    <div class="col-sm-2" >
 
     <select class="form-control" id="address" name="country">
      <option value="Japanese" {% if country == 'Japanese' %}selected="selected"{% endif %}>日本</option>
      <option value="china" {% if country == 'china' %}selected="selected"{% endif %}>中国</option>
    </select>
  </div>

  <div id="jjk"></div>
 
        

      </div>

      <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "head corp address" %}:</label>
        <div class="col-sm-9">
          <input type="text" class="form-control" style="width:100%" name="address" value="{{address}}">
        </div>
      </div>

        <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "industry involved" %}:</label>
       

        <div class="col-sm-2" >
    <select class="form-control" name="industryType">
    {% for x,y in industryList %}
   <option value="{{x}}" {% ifequal industryType x %}selected="selected"{% endifequal %}>{% trans y %}</option>
 
    {% endfor %}
            
          </select>
        </div>
      </div>

      <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "number of people" %}:</label>
        <div class="col-sm-2">
          <select class="form-control" name="peopleRange">
    <option value="1" {% ifequal peopleRange 1 %}selected="selected"{% endifequal %}>10人以内</option>
    <option value="2" {% ifequal peopleRange 2 %}selected="selected"{% endifequal %}>10 - 50人</option>
    <option value="3" {% ifequal peopleRange 3 %}selected="selected"{% endifequal %}>50 - 200人</option>
    <option value="4" {% ifequal peopleRange 4 %}selected="selected"{% endifequal %}>200人以上</option>
          </select>
        </div>
      </div>


      <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "logo" %}:</label>
        <div class="col-sm-8">
          <a class="btn btn-default blue" onclick="$('input[id=logo]').click();">{% trans "uploading" %}</a>
        </div>
      </div>


       <div class="form-group">
        <label  class="col-sm-3 control-label"></label>
        <div class="col-sm-8">
  <img src="/static/upload/{{logo}}" 
  id="returnlogo">
        </div>
      </div>

     <!--  <div class="form-group">
        <label  class="col-sm-3 control-label">{% trans "company picture" %}:</label>
        <div class="col-sm-8">
          <a class="btn btn-default blue" onclick="$('input[id=icon]').click();">{% trans "uploading" %}</a>
        </div>
      </div>
 -->

    </div>
    <div class="form-horizontal">

     <h2><span></span>{% trans "special" %}</h2>
      {% for x,y in company.company.items %}
      
      {% if forloop.counter0|divisibleby:"4" %}
       <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
        <div class="checkbox">
      {% endif %}
          <label class="col-sm-3">
            <input type="checkbox" value="{{x}}" name="tag[]" > 
        
         {% trans y %}
          </label>
      
      
       {% if forloop.counter|divisibleby:"4" and forloop.counter0 != 0 %}
  </div>
      </div>
    </div>

      {% endif %}


    {% endfor %}
    



  <h2><span></span>{% trans "subsidy" %}</h2>
    {% for x,y in company.welfare.items %}
      {% if forloop.counter0|divisibleby:"4" %}
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <div class="checkbox" >
      {% endif %}
       <label class="col-md-3">
  <input type="checkbox" value="{{x}}" name="tag[]">{% trans y %}
      </label>


     {% if forloop.counter|divisibleby:"4" and forloop.counter0 != 0 %}

    </div>
  </div>
</div>
{% endif %}
{% endfor %}

        </div>
      </div>
    </div>


<h2><span></span>{% trans "insurance" %}</h2>
 {% for x,y in company.insurance.items %}
      {% if forloop.counter0|divisibleby:"4" %}
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <div class="checkbox">

      {% endif %}

       <label class="col-md-3">
        <input type="checkbox" value="{{x}}" name="tag[]">
        {% trans y %}
      </label>
     
  {% if forloop.counter|divisibleby:"4" and forloop.counter0 != 0 %}

    </div>
  </div>
</div>
{% endif %}
{% endfor %}








    <h2><span></span>{% trans "vacation" %}</h2>
   {% for x,y in company.vacation.items %}
      {% if forloop.counter0|divisibleby:"4" %}
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <div class="checkbox">

      {% endif %}
     

        <label class="col-md-3">
        <input type="checkbox" value="{{x}}" name="tag[]"> {{y}}
      </label>  


       

   {% if forloop.counter|divisibleby:"4" and forloop.counter0 != 0 %}

    </div>
  </div>
</div>
{% endif %}
{% endfor %}

    </div>
  </div>
</div>





</div>


<div class="form-horizontal">
 <h2><span></span>{% trans "linkman" %}{% trans "information" %}</h2>
 <div class="form-group">
  <label  class="col-sm-3 control-label">{% trans "linkman" %}:</label>
  <div class="col-sm-4">
    <input type="text" class="form-control" id="appName" name="linkman" value="{{linkman|default:''}}">
  </div>
</div>


<div class="form-group">
  <label  class="col-sm-3 control-label">{% trans "phone" %}:</label>
  <div class="col-sm-4">
   <input type="text" class="form-control" id="appName" name="tel" value="{{tel}}">
 </div>
</div>



<div class="form-group">
  <label  class="col-sm-3 control-label">{% trans "mobile" %}:</label>
  <div class="col-sm-4">
    <input type="text" class="form-control"  id="appName" name="moblie" value="{{moblie}}">
  </div>
</div>

</div>

<h2><span></span>{% trans "company" %}{% trans "outline" %}</h2>
<div class="form-horizontal">
  <div class="form-group">
    <label  class="col-sm-3 control-label">{% trans "ceo" %}:</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" name="corporate" value="{{corporate}}">
    </div>
  </div>

  <div class="form-group">
    <label  class="col-sm-3 control-label">{% trans "established time" %}:</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" onclick="laydate()" id="appName" name="establishTime" value="{{establishTime|date:"Y-m-d"}}">
    </div>
  </div>


  <div class="form-group">
    <label  class="col-sm-3 control-label">{% trans "capital" %}:</label>
    <div class="col-sm-3 input-group" style="padding-left: 15px;">
    <input type="text" class="form-control" placeholder="一百万日元" name="capital" value="{{capital|default:''}}">

     <!-- <div class="input-group-addon">万日元</div> -->


   </div>
 </div>


 <div class="form-group">
  <label  class="col-sm-3 control-label">{% trans "certificate" %}:</label>
  <div class="col-sm-4">

    <a class="btn btn-default blue" onclick="$('input[id=cert]').click();">{% trans "uploading" %}</a>
  </div>
</div>

 <div class="form-group">
        <label  class="col-sm-3 control-label"></label>
        <div class="col-sm-8">
          <img src="/static/upload/{{cert}}" id="returncert">
        </div>
      </div>
{% csrf_token %}

<input type="hidden" id="cert" name="logo" value="{{logo}}">

<input type="hidden" id="cert" name="cert" value="{{cert}}">
</div>


<div class="form-group">
        <label class="col-sm-3 control-label"></label>
        <div class="col-sm-8">
   <input class="btn btn-default blue col-sm-3" type="submit" value="保存">

         <!--    <input class="btn btn-default blue col-sm-3" type="submit" value="{% trans "submit" %}"> -->

        </div>
</div>

</form>
<form id="logoForm" action="{% url "upload" %}" method="post" enctype="multipart/form-data">
   <input style="display:none" type="file" id="logo" name="file" onchange="uploadImage('logo')">
 
 {% csrf_token %}
</form>

<form id="certForm" action="{% url "upload" %}" method="post" enctype="multipart/form-data">
   <input style="display:none" type="file" id="cert" name="file" onchange="uploadImage('cert')">
 
 {% csrf_token %}
</form>
<!-- <input style="display:none" type="file" id="cert" name="file"> -->
</div>

</div>              
<script src="/static/js/jquery.form.min.js"></script>
<script type="text/javascript">
 
   {% if tag %}
{% for x in tag %}
   $('[name="tag[]"][value="{{x}}"]').attr('checked',true)
{% endfor %}
  {% endif %}


  
</script>

<script type="text/javascript">


 

    var back = ''
    function uploadImage(obj) { 
          back = obj
          var option = {
          url : '{% url "upload" %}',
          beforeSubmit : showRequest,
          success:showResponse,
        }

        $('#'+back+'Form').ajaxSubmit(
           option
        ); 
    }; 
    function showRequest(){
      
    }
    function showResponse(responseText){
      console.log(responseText.name)
      $('#return'+back).attr('src','/static/upload/' + responseText.name)
      $('[name='+back+']').val(responseText.name)
    }
</script>
<script type="text/javascript">
$(document).ready(function() {
 
   
    $('#pickupForm')
        .bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                name: {
                    message: 'The postal code is not valid',
                    validators: {
                        notEmpty: {
                            message: '{% trans "corp name" %}{% trans "is required and cannot be empty" %}'
                        },
                        stringLength: {
          
                        max: 25,
                        message: '25 {% trans "Can not be more than" %}'
                       }
                       
                      
                    }
                },
                fullName: {
                   
                    validators: {
                        notEmpty: {
                            message: '{% trans "corp name" %}{% trans "is required and cannot be empty" %}'
                        },
                        stringLength: {
          
                        max: 25,
                        message: '25 {% trans "Can not be more than" %}'
                       }
                    }
                },
                 recommend: {
                    validators: {
                        notEmpty: {
                            message: '{% trans "recommend" %}{% trans "is required and cannot be empty" %}'
                        },
                       
                        stringLength: {
          
                        max: 40,
                        message: '40 {% trans "Can not be more than" %}'
                       }
                    }
                },
                 url: {
                    message: 'The name is not valid',
                    validators: {
                        notEmpty: {
                            message: '{% trans "url" %} {% trans "is required and cannot be empty" %}'
                        },
                        regexp: {
                            regexp: /^(.*)\.?(.*)\.(.*)$/,
                            message: '{% trans "The input is not a valid url" %}'
                        },

                     
                    }
                },

                //  jpDesc: {
                //     message: 'The name is not valid',
                //     validators: {
                //         notEmpty: {
                //             message: '{% trans "introduce" %} {% trans "is required and cannot be empty" %}'
                //         },
                     
                //     }
                // },

                 address: {
                    message: 'The name is not valid',
                    validators: {
                        notEmpty: {
                            message: '{% trans "head corp address" %} {% trans "is required and cannot be empty" %}'
                        },
                        stringLength: {
                        max: 50,
                        message: '50 {% trans "Can not be more than" %}'
                       }
                     
                    }
                },

                 linkman: {
                    message: 'The name is not valid',
                    validators: {
                        notEmpty: {
                            message: '{% trans "linkman" %} {% trans "is required and cannot be empty" %}'
                        },
                     
                    }
                },

                  tel: {
                    message: 'The name is not valid',
                    validators: {
                        notEmpty: {
                            message: '{% trans "phone" %} {% trans "is required and cannot be empty" %}'
                        },
                     
                    }
                },

                 corporate: {
                    message: 'The name is not valid',
                    validators: {
                        notEmpty: {
                            message: '{% trans "ceo" %} {% trans "is required and cannot be empty" %}'
                        },
                     
                    }
                },


                 moblie: {
                    message: 'The name is not valid',
                    validators: {
                        notEmpty: {
                            message: '{% trans "mobile" %} {% trans "is required and cannot be empty" %}'
                        },
                        numeric: {
                          message: '{% trans "Only numbers are allowed" %}'
                        }
                     
                    }
                },

                //  establishTime: {
                //     message: 'The name is not valid',
                //     validators: {
                //         notEmpty: {
                //             message: '{% trans "established time" %} {% trans "is required and cannot be empty" %}'
                //         },
                     
                //     }
                // },

                 capital: {
                    message: 'The name is not valid',
                    validators: {
                        notEmpty: {
                            message: '{% trans "capital" %} {% trans "is required and cannot be empty" %}'
                        },
                     
                    }
                },



            }
        })
      })

function relieve(){
  $('input').attr('disabled',false)
    $('select').attr('disabled',false)
    $('textarea').attr('disabled',false)
}

  </script>

  <script type="text/javascript">
        UE.getEditor('jpDesc',{
            //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
            toolbars:[['Undo','Redo','Bold','test']],
            //focus时自动清空初始化时的内容
            allHtmlEnabled:false,
            autoClearinitialContent:false,
            textarea:'jpDesc',
            //关闭字数统计
            wordCount:false,
            //关闭elementPath
            elementPathEnabled:false,
            //默认的编辑区域高度
            initialFrameHeight:300
            //更多其他参数，请参考ueditor.config.js中的配置项
        })
    </script>
<script id="chinadom" type="text/html">
<div class="col-sm-2 " id="china">
          <select class="form-control" name="location" >
          {% for x,y in city.china.items %}
             <option value="{{x}}" {% if location == x %}selected="selected"{% endif %}>{{y}}</option>
          {% endfor %}
           
      
          </select>
        </div>
</script>
<script id="jpdom" type="text/html">

<div class="col-sm-2" id="jp">
    <select class="form-control " name="location">
     {% for x,y in city.japan.items %}
             <option value="{{x}}" {% if location == x %}selected="selected"{% endif %}>{{y}}</option>
          {% endfor %}
            
          </select>
   </div>
</script>

<script> 
 $('#address').on("change",function(){

    if (this.value == 'china'){
      var html = template('chinadom');
      $('#jjk').html(html);
      return
    }
    else if (this.value == 'Japanese'){
      var html = template('jpdom');
      $('#jjk').html(html);
      return
    }

  })
 



$(document).ready(function() {
   {% if country == 'china' %}
      var html = template('chinadom');
      $('#jjk').html(html);
      
   {% else %}
      var html = template('jpdom');
      $('#jjk').html(html);
      
  {% endif %}

  //  {% if name != '' %}
  //   $('input').attr('disabled',true)
  //   $('select').attr('disabled',true)
  //   $('textarea').attr('disabled',true)
  // {% endif %}


})
</script>

{% endblock %}  


